package locations.actions;

import javax.servlet.http.HttpServletRequest;

import locations.dao.DAOFactory;
import locations.dao.InstitutionResponsibleDAO;
import locations.model.InstitutionResponsible;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class EditInstitutionResponsibleAction  extends ActionSupport implements ModelDriven<InstitutionResponsible>, ServletRequestAware  {

	private static final long serialVersionUID = -8124967730231198191L;
	
	private HttpServletRequest request; 
	private InstitutionResponsible institutionResponsible = new InstitutionResponsible();
	private String pageTitle = "Nuevo Responsable de Institucion";
	
	public String execute(){
		Long id = Long.parseLong(this.getRequest().getParameter("id"));
		InstitutionResponsibleDAO dao = DAOFactory.getInstitutionResponsibleDAO();
		this.institutionResponsible = dao.retrieveById(id);
		return SUCCESS;
	}
	
	
	
	public HttpServletRequest getRequest() {
		return request;
	}

	
	
	
	
	
	
	
	
	
	
	public InstitutionResponsible getInstitutionResponsible() {
		return institutionResponsible;
	}



	public void setInstitutionResponsible(
			InstitutionResponsible institutionResponsible) {
		this.institutionResponsible = institutionResponsible;
	}



	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	@Override
	public InstitutionResponsible getModel() {
		return null;
	}
	
	

}
